#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

#include "mylog.h"

int* thread1(void * arg)
{
	while(1) 
	{
//	printf("thread1 running\n");
		write_log("thread1",WARN);
		sleep(1);
	}
}
int* thread2(void * arg)
{
	while(1) 
	{
//		printf("thread 2 running\n");
		write_log("thread2",FATAL);
		sleep(2);
	}
}
int* thread3(void * arg)
{
	while(1) 
	{
//	printf("thread3 running\n");
		write_log("thread3",WARN);
		sleep(3);
	}
}
int main()
{
 pthread_t thid1,thid2,thid3;
 if(pthread_create(&thid1,0,(void*)thread1,0)!=0)
 {
	 printf("thread creation failed\n");
	 exit(1);
 }
 sleep(1);
if(pthread_create(&thid2,0,(void*)thread2,0)!=0)
 {
	 printf("thread creation failed\n");
	 exit(1);
 }
if(pthread_create(&thid3,0,(void*)thread3,0)!=0)
 {
	 printf("thread creation failed\n");
	 exit(1);
 }
sleep(10);
return 0;

}

